# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Maintainer: Robin Candau <antiz@archlinux.org>
# Contributor: unikum <unikum.pm@gmail.com>
# Contributor: speed145a <jonathan@tagchapter.com>

pkgname=firewalld
pkgver=1.3.2
pkgrel=1
pkgdesc='Firewall daemon with D-Bus interface'
arch=(any)
url=https://firewalld.org/
license=(GPL2)
depends=(
  dbus-python
  glib2
  hicolor-icon-theme
  nftables
  python-capng
  python-gobject
)
makedepends=(
  docbook-xsl
  git
  intltool
  podman
)
optdepends=(
  'bash-completion: bash completion'
  'gtk3: firewall-config'
  'libnotify: firewall-applet'
  'networkmanager: NetworkManager support'
  'polkit: privileged actions'
  'python-pyqt5: firewall-applet'
)
backup=(
  etc/conf.d/firewalld
  etc/firewalld/firewalld.conf
)
_tag=b7bb3d051c1900f5870ffb94514ca797ffecbe13
source=(
  git+https://github.com/firewalld/firewalld.git#tag=${_tag}
  firewalld-sysconfigdir.patch
)
sha256sums=(
  SKIP
  cf7d655230c43acf10a0f97dffdbcba136729967c8b9a25a930871d54a589834
)

prepare() {
  cd firewalld
  git cherry-pick -n 3337c9a4e63bd42535b6b3e97a91f4b502c063ce
  patch -Np1 -i ../firewalld-sysconfigdir.patch
  NOCONFIGURE=true ./autogen.sh
}

pkgver() {
  cd firewalld
  git describe --tags | sed 's/^v//'
}

build() {
  cd firewalld
  ./configure \
    --prefix=/usr \
    --localstatedir=/var \
    --sbindir=/usr/bin \
    --sysconfdir=/etc \
    --disable-schemas-compile \
    --disable-sysconfig
  make
}

package() {
  make DESTDIR="${pkgdir}" -C firewalld install
  python -m compileall -d /usr/lib "$pkgdir/usr/lib"
  python -O -m compileall -d /usr/lib "$pkgdir/usr/lib"
}

# vim: ts=2 sw=2 et:
